<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body class="pear-container">
<div class="layui-card">
  <div class="layui-card-body">
    <form class="layui-form" action="">
      <div class="layui-form-item">
        <div class="layui-form-item layui-inline">
          <label class="layui-form-label">姓名</label>
          <div class="layui-input-inline">
            <input type="text" name="username" placeholder="" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item layui-inline">
          <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="query">
            <i class="layui-icon layui-icon-search"></i>
            查询
          </button>
          <button type="reset" class="pear-btn pear-btn-md">
            <i class="layui-icon layui-icon-refresh"></i>
            重置
          </button>
        </div>
      </div>
    </form>
  </div>
</div>
<div class="layui-card">
  <div class="layui-card-body">
    <table id="dataTable" lay-filter="dataTable"></table>
  </div>
</div>

<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script>
  layui.use(['table', 'form', 'jquery','common'], function() {
    let table = layui.table;
    let form = layui.form;
    let $ = layui.jquery;
    let common = layui.common;

    form.on('submit(query)', function(data) {
      table.reload('dataTable', {
        where: data.field,
        page:{curr: 1}
      })
      return false;
    });

    let MODULE_PATH = "{$Request.root}/admin.employee/";

    let cols = [
      [
        {
          field: 'username',
          title: '姓名',
          sort: true,
          unresize: true,
          align: 'center'
        },{
        field: 'dept_name',
        title: '原部门',
        unresize: true,
        align: 'center'
      },{
        field: 'induction_date',
        title: '入职时间',
        unresize: true,
        align: 'center'
      },{
        field: 'quit_date',
        title: '离职时间',
        unresize: true,
        align: 'center'
      }, {
        field: 'quit_reason',
        title: '离职原因',
        unresize: true,
        align: 'center'
      }
      ]
    ]

    table.render({
      elem: '#dataTable',
      url: MODULE_PATH + 'index',
      page: true,
      cols: cols,
      cellMinWidth: 100,
      skin: 'line',
      toolbar: '#toolbar',
      defaultToolbar: [{
        title: '刷新',
        layEvent: 'refresh',
        icon: 'layui-icon-refresh',
      }, 'filter', 'print', 'exports']
    });
  })
</script>
</body>
</html>
